package com.smbms.service.role;

import cn.hutool.core.util.ObjectUtil;
import com.smbms.dao.role.RoleDao;
import com.smbms.dao.role.RoleDaoImpl;
import com.smbms.pojo.Role;
import com.smbms.utils.DBUtils;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description 描述
 * @Author 羽落陌殇
 * @Date 2021/7/19 17:04
 * @Version 1.0.0
 */
public class RoleServiceImpl implements RoleService {
    private RoleDao roleDao = new RoleDaoImpl();
    @Override
    public List<Role> getRoleList() {
        List<Role> roleList = new ArrayList<>();
        Connection connection = DBUtils.getConnection();
        if (ObjectUtil.isNotNull(connection)) {
            try {
                roleList = roleDao.getRoleList(connection);
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        return roleList;
    }
}
